package com.example.utils;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;

import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.google.android.material.snackbar.Snackbar;
import com.google.gson.Gson;

import java.io.IOException;
import java.util.ArrayList;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

public class MainActivity2 extends AppCompatActivity {

    ArrayList<String> list = new ArrayList<>();
    RecyclerView recyclerView;
    ViewPager2 viewPager2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        recyclerView = findViewById(R.id.recycleView);
        viewPager2 = findViewById(R.id.ViewPager2);
        initView();
        setViewPager2();
    }

    public void initView(){
        for (int i = 0; i < 20; i++) {
            list.add(i+"qwertyuiop");
        }

        LinearLayoutManager manager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(manager);
        RecyclerViewAdapter adapter = new RecyclerViewAdapter(list);
        recyclerView.setAdapter(adapter);
        adapter.SetRecycleClickItemListener(new RecyclerViewAdapter.OnRecycleViewItemClick() {
            @Override
            public void OnRecycleViewItemClick(int position) {
                Log.d("TAG", "OnRecycleViewItemClick: "+position);
                Toast.makeText(MainActivity2.this, ""+position, Toast.LENGTH_SHORT).show();
            }
        });
    }

    public void setViewPager2(){
        
    }
}